# 登录
import requests
url='http://ihrm-test.itheima.net/api/sys/login'
header={"Content-Type": "application/json"}
body={"mobile": "13800000002","password": "123456"}
req=requests.post(url=url,headers=header,json=body)
print(req.json())
# assert 200==req.status_code
# assert True==req.json().get("success")
# assert '操作成功！'==req.json().get("message")
# token=req.json().get("data")
# print(token)
# 添加
# url1="http://ihrm-test.itheima.net/api/sys/user"
# header1={"Content-Type":"application/json", "Authorization":token}
# body1={
#     "username": "小猪佩奇",
#     "mobile": "18279118563",
#     "workNumber": "22"}
# req1=requests.post(url=url1,headers=header1,json=body1)
# assert 200==req1.status_code
# assert True==req1.json().get("success")
# assert 10000==req1.json().get("code")
# assert '操作成功！'==req1.json().get("message")
# id=req1.json().get("data").get("id")
# print(id)

# 查询
# url4="http://ihrm-test.itheima.net/api/sys/user/"+str(id)
# header4={"Authorization":token}
# req4=requests.get(url=url4,headers=header4)
# print(req4.json())

# 修改
# url2="http://ihrm-test.itheima.net/api/sys/user/"+str(id)
# header2={"Content-Type":"application/json", "Authorization":token}
# body2={"username": "齐天大圣"}
# req2=requests.put(url=url2,headers=header2,json=body2)
# print(req2.json())
# # 删除
# url3="http://ihrm-test.itheima.net/api/sys/user/"+str(id)
# header3={"Authorization":token}
# req3=requests.delete(url=url3,headers=header3)
# print(req3.json())



